<template>
  <div class="profile-page">
    <el-row>
      <el-col :span="24">
        <router-link to="/" class="home-link">首页</router-link>
        <router-link to="/codelover" class="home-link">课程选择</router-link>
    <router-link to="/score" class="home-link">个人成绩</router-link>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <h1>个人介绍</h1>
      </el-col>
    </el-row>
    <el-row class="profile-info">
      <el-col :span="24">
        <div class="profile-avatar-container">
          <img :src="avatarUrl" alt="Avatar" class="profile-avatar" />
        </div>
        <h2>{{ userName }}</h2>
        <p>兴趣爱好: {{ interests }}</p>
        <p>邮箱: {{ email }}</p>
      </el-col>
    </el-row>
    <el-row class="test">
      <el-col :span="24">
        <h3>vue自动化测试</h3>
        <div class="screenshots">
          <img src="/img/test1.png" class="screenshot" />
          <img src="/img/test2.png" class="screenshot" />
        </div>
      </el-col>
    </el-row>
  </div>
</template>
  
<script>
import { ref, onMounted } from 'vue';

export default {
  name: 'Profile',
  setup() {
    const userName = ref('Li XingLian');
    const bio = ref('这是一个关于我自己的简短介绍');
    const interests = ref('阅读、旅行、看电影');
    const email = ref('3109724056@qq.com');
    const avatarUrl = ref('https://img1.baidu.com/it/u=102443593,1548317231&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500');
    return {
      userName,
      bio,
      interests,
      email,
      avatarUrl,
    };
  }
};  
</script>  
  
<style scoped>

.profile-page {
  padding: 20px;
  font-family: Arial, sans-serif;
  background-color: #f9f9f9;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 800px;
  margin: 2rem auto; 
}

.home-link {
  float: left;
  font-size: 16px;
  text-decoration: none;
  color: #98afc7;
  margin-right: 20px;
}

.home-link:hover {
  text-decoration: underline;
}

h1 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.profile-avatar-container {
  text-align: center;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 150px; 
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
}

h2, p {
  text-align: center;
  margin: 0.5rem 0;
}

p:last-child {
  font-size: 1rem;
}

.test {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.test img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: unset; 
  height: unset;
}

@media (max-width: 768px) {
  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  h1 {
    font-size: 2rem;
  }

  .test img {
    width: 100%; 
  }
}
</style>